package com.gitee.kenewstar.utils;

import com.gitee.kenewstar.exception.CommonException;
import java.util.Objects;

/**
 * 断言工具
 *
 * @author kenewstar
 * @date 2022/2/22
 */
public abstract class AssertUtil {

	public static void throwException(String msg) {
		throwException(new CommonException(msg));
	}

	public static void throwException(Exception e) {
		throw new CommonException(e);
	}

	public static void throwException(String msg, Exception e) {
		throw new CommonException(msg, e);
	}

	public static void notNull(Object obj) {
		if (Objects.isNull(obj)) {
			throwException("参数不能为空");
		}
	}

	public static void notBlank(String str) {
		if (Objects.isNull(str) || str.trim().length() == 0) {
			throwException("字符串不能为空");
		}
	}



}
